from datetime import timedelta

# 后台首页展示时间线数量
TIMELINE_COUNT = 10

# DRF配置
REST_FRAMEWORK = {
    "UNAUTHENTICATED_USER": None,
    # 异常处理
    'EXCEPTION_HANDLER': 'utils.common_handle_exceptions.exception_handle',
    # 认证类
    'DEFAULT_AUTHENTICATION_CLASSES': [
        'utils.authenticate.UserAuthenticate'
    ],
    # 权限类
    'DEFAULT_PERMISSION_CLASSES': [

    ],
    # 频率类
    'DEFAULT_THROTTLE_CLASSES': [
        'utils.throttle.CommonThrottle'
    ],
    # 过滤类
    'DEFAULT_FILTER_BACKENDS': (
        'django_filters.rest_framework.DjangoFilterBackend',
    ),
}

# jwt签发token的配置
CCSP_JWT = {
    # token有效期设置7天
    'ACCESS_TOKEN_LIFETIME': timedelta(days=7)
}

# 腾讯云发送短信配置
TX_SMS_SETTINGS = {
    'TEMPLATE_ID': '2152168'
}

# celery配置
CELERY_BROKER_URL = 'redis://127.0.0.1:6379/0'
# BACKEND配置，使用redis
CELERY_RESULT_BACKEND = 'redis://127.0.0.1:6379/1'
CELERY_ACCEPT_CONTENT = ['json']
CELERY_TASK_SERIALIZER = 'json'
# 结果序列化方案
CELERY_RESULT_SERIALIZER = 'json'
# 任务结果过期时间，秒
CELERY_TASK_RESULT_EXPIRES = 60 * 60 * 24
# 时区配置
CELERY_TIMEZONE = 'Asia/Shanghai'
# 定时任务设置
# CELERY_BEAT_SCHEDULE = {}

# # 支付宝支付配置
# # 开发阶段地址
# # 开发环境地址
# # BACKEND_URL = 'http://127.0.0.1:8000/'
# # CCSP_URL = 'http://127.0.0.1:8080'
# # 上线环境地址
# BACKEND_URL = 'http://www.lea4ning.top:8000/'
# CCSP_URL = 'http://www.lea4ning.top:80'
# # 支付宝同步异步回调接口配置
# # 后台异步回调接口
# NOTIFY_URL = BACKEND_URL + "api/v1/order/success/"
# # 前台同步回调接口，没有 / 结尾
# RETURN_URL = CCSP_URL + "/pay/success"
